<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="../static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="../static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="../static/easyui/themes/icon.css">
<link rel="stylesheet" href="../static/easyui/themes/metro-orange/easyui.css">
<link rel="stylesheet" href="../static/easyui/themes/metro-red/window.css">
</head>
<body>
<script type="text/javascript">
$('#tt').tabs({
    border:false,
    onSelect:function(title){
		alert(title+' is selected');
    }
});


//判断试卷是否批改完
function bbbfgf(ZKZID){
	$.ajax({
			url:"shijuanpigaiselect",
			type:"post",
			data:{"ZKZID":ZKZID},
			success:function(data){
				console.log(data);
				if(parseInt(data)==0){
					var text='改试卷';
					var url="tyl/gai-shi-juan";
					var data="ZKZID="+ZKZID;
					adds(text,url,data);
				}else{
					$("#pgsj_tankuang").window("open"); 
				}
			}
	})
	
}
    $(".pgsjqueding").click(function(){
    	$("#pgsj_tankuang").window("close"); 
    })
$(function(){
	//初始化表格
	$('#pgsj_zhaopin').datagrid({
	    url:'pigaishijuan',
	    columns:[[
			{field:'OUTID',width:120,title:'试卷编号',align:'center'},
			{field:'OUTNAME',width:320,title:'试卷名称',align:'center'},
			{field:'EMPNAME',width:320,title:'',align:'center',hidden:true},
			{field:'RSENAME',width:320,title:'',align:'center',hidden:true},
			{field:'NAME',width:320,title:'姓名',align:'center',
				formatter: function(value,row,index){
					if(row["EMPNAME"]=="")
						return row["RSENAME"]
					if(row["RSENAME"]=="")
						return row["EMPNAME"]
				}
			},
			{field:'ZKZID',width:320,title:'准考证id',align:'center',hidden:true},
			{field:'ZKZREM',width:320,title:'准考证',align:'center'},
			{field:'TRTSID',width:320,title:'',align:'center',hidden:true},
			{field:'caozuo',width:260,formatter:operate,title:'操作',align:'center'} 
	    ]],
	    pagination:true,
	    pageNumber:1,
	    pageSize:5,
	    pageList:[5,10,15]
	});
})	
//在每个操作列里面添加编辑，查看，明细，删除
function operate(value, row, index) {
    	if(row["TRTSID"]==""){
    		 return "<button class='pgsj_pigai' onClick='bbbfgf("+row['ZKZID']+")'>批改</button>";
    	}else{
    		 return "<button class='pgsj_pigais ' onClick='bbbfgf("+row['ZKZID']+")'>已批改</button>";
    	}
} 


</script>
                <div id="pgsj_tankuang" class="easyui-window" title="AWSLNB" style="width:320px;height:205px"
		    		       data-options="closed:true,minimizable:false,maximizable:false,collapsible:false,modal:true">
		    		             <div class="pgsj_tankuangone">
		    		             	        <div class="pgsj_pigai1">该试卷已批改</div>
		    		             </div> 
		    		             <div class="pgsj_tankuangtwo">
		    		                  <button id="dsx-beok" class="pgsjqueding">确定</button>
		    		             </div>
		    		</div>
	  <div class="pigaishijuan_zong">
	          <div class="pigaishijuan_top"></div>
             	<div class="pgsj_left">
                   	<div class="pgsj_zhaopin">待批改试卷</div>
                    <div style="margin-left:20px;">
		                   	<table id="pgsj_zhaopin" class="easyui-datagrid"
			                   style="width:100%;height:340px"
	    	                  data-options="fitColumns:true">
		                    </table>
	                </div>
                </div>
              
      </div> 
</body>
</html>